'use strict'

class goods{
    constructor(mdb){
        this.db=mdb
        this.tablename='goods'
    }
    model(){
        return this.db.model(this.tablename)
    }
    
    async list () {
        let ulist = await this.model().limit(20).select()
        return ulist.rows
    }

    async sel(goodsid){
        let ulist = await this.model().limit(20).where({goodsid}).select()
        return ulist.rows
    }

    async select (keyword) {
        let ulist = await this.model().limit(20).where({
            goodsname:{'ILIKE' : `%${keyword}%`}
        }).select()
        return ulist.rows
    }
}
module.exports=goods